#define _CRT_SECURE_NO_WARNINGS 1


#include "string.h"

namespace bit
{
	void test_string1()
	{
		string s1;
		string s2("hello world");
		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;

		for (size_t i = 0; i < s2.size(); i++)
		{
			s2[i] += 2;
		}
		cout << s2.c_str() << endl;

		for (auto e : s2)
		{
			cout << e << " ";
		}
		cout << endl;

	}
	void test_string2()
	{
		string s1("hello world");
		s1 += 'x';
		s1 += '#';
		cout << s1.c_str() << endl;
		s1 += "hello bit";
		cout << s1.c_str() << endl;
		s1.insert(0, "$$$");
		cout << s1.c_str() << endl;

	}
	void test_string3()
	{
		string s1("hello world");
		s1.erase(7, 100);
		cout << s1.c_str() << endl;
	}
	void test_string4()
	{
		string s("test.cpp.zip");
		size_t pos = s.find('.');
		string suffix = s.substr(pos);
		cout << suffix.c_str() << endl;

		string copy(s);
		cout << copy.c_str() << endl;

		s = suffix;
		cout << s.c_str() << endl;
		cout << suffix.c_str() << endl;

	}
	void test_string5()
	{
		string s1("hello world");
		string s2("hello world");

		cout << (s1 < s2) << endl;

		cout << s1 << s2 << endl;
		cin >> s1;
		cout << s1 << endl;
	}
	void test_string6()
	{
		string s1("hello world");
		string s2 = s1;

		cout << s1 << endl;
		cout << s2 << endl;

		string s3("xxxxxxxxxxx");
		s1 = s3;
		cout << s1 << endl;
		cout << s3 << endl;


	}
}
int main()
{
	bit::test_string6();
	return 0;
}